<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name=”viewport” content=”width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no” />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/Css/styles.css"/>
    <script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.8.3.min.js"></script>
</head>
<body>


<div class="wrapper">

    <div class="container">
        <h1>炸金花后台管理</h1>
        <form class="form" href="/" id="subForm" method="post">
            <input type="text" placeholder="Username" id="userAccount" name="userAccount"
                   onkeydown="javascript:if(this.value=='用户名')this.value=''"
                   onClick="javascript:if(this.value=='用户名')this.value=''"/>
            <div id="loginNameMsg" style="padding-left:35px;margin-top:0px;font-size:12px; color:red;"></div>
            <input type="password" placeholder="Password" id="password" name="password"/>
            <div id="passWordMsg" style="padding-left:35px;margin-top:0px;font-size:12px; color:red;"></div>
            <br>
            <input type="button" id="subBtn" name="subBtn" onclick="submitFunction();"
                   style="background-color: white;color: #53e3a6" value="登录"/>
        </form>
    </div>

    <ul class="bg-bubbles">
        <li></li>
        <li></li>

    </ul>
</div>
</body>
<script type="text/javascript">
    //后台返回信息展示
    var message = "${message}";

    if(message!=""){
        var username = message.indexOf("用户");
        var password = message.indexOf("密码");
        var checkcode = message.indexOf("验证码");
        $('#hid').val('1');
        if(username != -1) {
            $('#loginNameMsg').html(message);
        }
        if(password != -1) {
            $('#passWordMsg').html(message);
        }

    }

    if(message.length < 1){
        document.getElementById("yzm").style.display='none';
    }else{
        if(message.substring(0,4)== "密码错误"){
            document.getElementById("loginName").value = "${errorcode}";
        }
        document.getElementById("yzm").style.display="block";
    }

    function submitFunction() {
        var subform = document.getElementById("subForm");
        var url = "<%=basePath%>" + 'user/login.html';
        subform.action = url;
        subform.submit();
    }
</script>
</html>
